package cn.dawn.webcollector.net;

import java.net.InetSocketAddress;
import java.net.Proxy;

public class SingleProxyGenerator implements ProxyGenerator {

	protected Proxy proxy = null;

	public SingleProxyGenerator() {

	}

	public SingleProxyGenerator(Proxy proxy) {
		this.proxy = proxy;
	}

	public SingleProxyGenerator(String host, int port, Proxy.Type type) {
		proxy = new Proxy(type, new InetSocketAddress(host, port));
	}

	public SingleProxyGenerator(String host, int port) {
		proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
	}

	@Override
	public Proxy next(String url) {
		return proxy;
	}

	public Proxy getProxy() {
		return proxy;
	}

	public void setProxy(Proxy proxy) {
		this.proxy = proxy;
	}

	@Override
	public void markBad(Proxy proxy, String url) {
	}

	@Override
	public void markGood(Proxy proxy, String url) {
	}

}
